<?php
//menu
echo "
	<div style='display:block; text-align:right; float:right;'>
		<div class='menu_messages'><a href='/messages/compose'>" . Language::Get('Compose') . "</a></div> 	
		<div class='menu_messages'><a href='/messages/inbox'>" . Language::Get('Inbox') . "</a></div> 
		<div class='menu_messages'><a href='/messages/outbox'>" . Language::Get('Outbox') . "</a></div>
	</div>"; 

//Inbox
$msg = $this->data['message'];
echo "
	<div class='pageHeading'>" . Language::Get('View message') . "</div>
	<table cellspacing='0' cellpadding='4' border='0' width='100%' class='showMessage'>";
if ($msg['type'] == 'out')
{
	echo "<tr>
			<td class = 'composeForm'>" . Language::Get('Whom') . ":</td>
			<td class = 'composeForm'>" . $msg['recepient_email'] . "</td>
		</tr>";
}
else if ($msg['type'] == 'in')
{
	echo "<tr>
			<td class = 'composeForm'>" . Language::Get('From whom') . ":</td>
			<td class = 'composeForm'>" . $msg['client_email'] . "</td>
		</tr>";
}
echo "	<tr>
			<td class = 'composeForm'>" . Language::Get('Date') . ":</td>
			<td class = 'composeForm'>" . $msg['datetime'] . "</td>
		</tr>";
echo "	<tr>
			<td class = 'composeForm'>" . Language::Get('Topic') . ":</td>
			<td class = 'composeForm'>" . $msg['topic'] . "</td>
		</tr>";
echo "	<tr>
			<td class = 'composeForm'>" . Language::Get('Content') . ":</td>
			<td class = 'composeForm'>" . $msg['text'] . "</td>
		</tr>";
echo "</table>";

//reply
echo "
<div class='pageHeading'></div>
<table cellspacing='0' cellpadding='0' border='0' style='margin-top:8px;'>
	<tr>
		<td class='btnType-5-left btnType-5-left-select'></td>
		<td class='btnType-5-center btnType-5-center-select' align='center'>
			<span class='btnType-5-txt cpointer' onclick='Reply()'>" . ($msg['type'] == 'in' ? Language::Get('Reply') : Language::Get('Send new message')) . "</span>
		</td>
		<td class='btnType-5-right btnType-5-right-select'></td>
	</tr>
</table>";

$recepient = ($msg['type'] == 'in' ? HTTPContext::$session['ref_number'] : $msg['recepient_reference']);

XHTML::Script("", "
	function Reply()
	{
		window.location.assign('/messages/compose/?recepient=" . $recepient . "');
	}
");

?>